#!/usr/env/bin python
"""
"""
from pynchon.core.object import (Object0d, ObjectVector0d, ObjectArray0d, \
                                 Object2d, ObjectVector2d, ObjectArray2d)

# example 1: creating a 0d string object.
#########################################
# The strings can be of arbitrary length, but their fvals have to be equal.
string1 = Object0d('string1', fval='')
string2 = Object0d('string2', fval='')
# We concatenate the two 0d objects into a vector of 0d objects
string_vector1 = ObjectVector0d((string1, string2), fval='')
# the shape of the vector is (2,)
assert string_vector1.shape == (2,)
# and it's dtype is object
assert string_vector1.dtype == 'object'
# lest's create a few more string objects 
string3 = Object0d('string3', fval='')
string4 = Object0d('string4', fval='')
string5 = Object0d('string5', fval='')
string_vector2 = ObjectVector0d((string3, string4, string5), fval='')
# the shape of the new vector is (3,)
assert string_vector2.shape == (3,)
# we can create an array of two vectors, but because one of the vectors is
# longer the shorter one has to be extended with the fval 
string_array1 = ObjectArray0d((string_vector1, string_vector2), fval='')
# the shape of this array is (2,3) where 2 is the number of vectors and 3 is 
# equal to the length of the longest vector

# example 2: creating a 2d string object.
#########################################
# A 2d string objects means that each element of an array should be a tuple of
# 2 strings.
# The strings can be of arbitrary length, but their fval have to be strings
# and have to be equal.
strings1 = Object2d(('strings1a', 'strings1b'), fval=('filla', 'fillb'))
strings2 = Object2d(('strings2a', 'strings2b'), fval=('filla', 'fillb'))
# We concatenate the two 0d objects into a vector of 0d objects
strings_vector1 = ObjectVector2d([strings1, strings2], fval=('filla', 'fillb'))
## the shape of the vector is (2,)
assert strings_vector1.shape == (2,)
## and it's dtype is object
assert strings_vector1.dtype == [('i0', '|O8'), ('i1', '|O8')]
## lest's create a few more double string objects 
strings3 = Object2d(('strings3a', 'strings3b'), fval=('filla', 'fillb'))
strings4 = Object2d(('strings4a', 'strings4b'), fval=('filla', 'fillb'))
strings5 = Object2d(('strings5a', 'strings5b'), fval=('filla', 'fillb'))
strings6 = Object2d(('strings6a', 'strings6b'), fval=('filla', 'fillb'))
strings_vector2 = ObjectVector2d((strings3, strings4, strings5, strings6), fval=('filla', 'fillb'))
## the shape of the new vector is (3,)
assert strings_vector2.shape == (4,)
## we can create an array of two vectors, but because one of the vectors is
## longer the shorter one has to be extended with the fval 
strings_array1 = ObjectArray2d((strings_vector1, strings_vector2), fval=('filla', 'fillb'))
assert strings_array1.shape == (2,4)
## the shape of this array is (2,4) where 2 is the number of vectors and 4 is 
## equal to the length of the longest vector

